package com.mison.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mison.core.Action;
import com.mison.core.FrameworkFather;
import com.mison.core.Result;
import com.mison.dao.LiuswDao;
import com.mison.model.MisonFeedbackPerson;
import com.mison.utils.Page;

public class LiuswAction extends FrameworkFather{

	private Page<MisonFeedbackPerson> page = new Page<MisonFeedbackPerson>(10);
	
	
	public Page<MisonFeedbackPerson> getPage() {
		return page;
	}

	public void setPage(Page<MisonFeedbackPerson> page) {
		this.page = page;
	}

	public void setCurrPage(int currPage) {
		page.setCurrPage(currPage);
	}


	public Result execute(HttpServletRequest request,
			HttpServletResponse response, Action action) {
		
		LiuswDao dao = new LiuswDao();
		
		page.setList(dao.getList(page));
		
		int total = dao.getCount();
		
		page.setTotalCount(total);
		
		page.setMaxPage((int)Math.ceil((double)total/page.getPerPage()));
		
		return action.getResult("r1");
	}

}
